<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('修改销售内容')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
	<form class="form-horizontal m" id="form-post-edit" th:object="${sell}">
		<input id="sellOrderId" name="sellOrderId" type="hidden" th:field="*{sellOrderId}"/>
		<div class="form-group">
			<label class="col-sm-3 control-label">项目名称：</label>
			<div class="col-sm-8">
				<input class="form-control" type="text" name="sellOrderName" id="sellOrderName" th:field="*{sellOrderName}" required>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">客户信息：</label>
			<div class="col-sm-8">
				<input class="form-control" type="text" name="sellOrderCusinfo" id="sellOrderCusinfo" th:field="*{sellOrderCusinfo}" required>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label ">项目总额：</label>
			<div class="col-sm-8">
				<input class="form-control" type="text" name="sellOrderPrice" id="sellOrderPrice" th:field="*{sellOrderPrice}" required>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">配送方式：</label>
			<div class="col-sm-8">
				<input class="form-control" type="text" name="sellOrderDelivery" id="sellOrderDelivery" th:field="*{sellOrderDelivery}" required>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">销售人员：</label>
			<div class="col-sm-8">
				<input class="form-control" type="text" name="sellOrderSales" id="sellOrderSales" th:field="*{sellOrderSales}" required>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">部门负责人：</label>
			<div class="col-sm-8">
				<input class="form-control" type="text" name="sellOrderDeptcharge" id="sellOrderDeptcharge" th:field="*{sellOrderDeptcharge}" required>
			</div>
		</div>
	</form>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">
	var prefix = ctx + "sell/order";

	$("#form-post-edit").validate({
		onkeyup: false,
		rules:{
			postName:{
				remote: {
					url: ctx + "sell/order/checkSellOrderNameUnique",
					type: "post",
					dataType: "json",
					data: {
						"sellOrderId": function() {
							return $("input[name='sellOrderId']").val();
						},
						"sellOrderName" : function() {
							return $.common.trim($("#sellOrderName").val());
						}
					},
					dataFilter: function(data, type) {
						return $.validate.unique(data);
					}
				}
			},
			sellOrderId:{
				digits:true
			},
		},
		messages: {
			"sellOrderName": {
				remote: "项目名称已经存在"
			}
		},
		focusCleanup: true
	});

	function submitHandler() {
		if ($.validate.form()) {
			$.operate.save(prefix + "/edit", $('#form-post-edit').serialize());
		}
	}
</script>
</body>
</html>
